/***
 * Tirgul for Date
 * @author yevgenis
 *
 */
public class Date {
	
	private int _month;
	private int _year;
	private int _day;
	
	/***
	 * Basic Constructor
	 * @param day
	 * @param month
	 * @param year
	 */
	public Date (int day,int month, int year)
	{
		_day = day;
		_month = month;
		_year = year;
	}
	
	
	/**
	 * Copy Constructor
	 */
	public Date (Date d)
	{
		_day = d._day;
		_month = d._month;
		_year = d._year;
	}
	
	
	public int getDay ()
	{
		return this._day;
	}
	
	
	public int getMonth ()
	{
		return _month;
	}
	
	public int getYear()
	{
		
		return _year;
	}
	
	public void setDay (int d)
	{
		
		_day = d;
	}
	
	public void setMonth(int m)
	{
		_month = m;
	}
	
	
	public void setYear (int y)
	{
		_year = y;
	}
	
	public String toString()
	{
		
		return _day+"/"+_month+"/"+_year;
		
	}
	
/**	
 * 	check if the given date equals to the Instance Date
 * @param d
 * @return 
 */
	public boolean isEqual(Date d)
	{
		if ( d._year == _year &&
				d._month == _month &&
					d._day == _day	)
			return true;
		
		return false;
			
	}
	
	/**
	 * compares the given date to the Current date
	 * @param d
	 * @return   0: Dates are Equal
	 *			 1: Current Date comes before given
	 *			 2: Current Date comes after Given				
	 */
	public int compareTo(Date d)
	{
		
		
		if ( d._year > _year)
			return 1;
		else if(d._year < _year)
			return 2;
			
		if(d._month > _month)
			return 1;
		else if(d._month < _month)
			return 2;
		
		if(d._day > _day)
			return 1;
		else if(d._day < _day)
			return 2;
		
		return 0;
	}
	/**	
	 * 19XX 20XX
	 * @return
	 */
	public boolean isLastCentury()
	{
		
		// Calculate the Century
		int century = _year/100;
		
		if( century == 19)
		{
			return true;
		}
		
		return false;
	}
}
